//
//  TableViewCellOfContact.m
//  TableViewCell的删除
//
//  Created by dllo on 16/3/28.
//  Copyright © 2016年 付冬梅. All rights reserved.
//

#import "TableViewCellOfContact.h"

@implementation TableViewCellOfContact

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell {
    self.bigView = [[UIScrollView alloc] init];
    [self.contentView addSubview:self.bigView];
    
    self.nameLabel = [[UILabel alloc] init];
    [self.bigView addSubview:self.nameLabel];
    
    
    self.phoneLabel = [[UILabel alloc] init];
    [self.bigView addSubview:self.phoneLabel];
    
    
    self.deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.bigView addSubview:self.deleteButton];
    
}

- (void)layoutSubviews {
    self.bigView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
    self.bigView.showsHorizontalScrollIndicator = NO;
    self.bigView.pagingEnabled = YES;
    self.bigView.backgroundColor = [UIColor yellowColor];
    self.bigView.contentSize = CGSizeMake(self.contentView.frame.size.width + 50, 0);
//    self.bigView.contentOffset = CGPointMake(0, 0);
    
    self.nameLabel.frame = CGRectMake(10, 10, 150, 30);
    self.nameLabel.backgroundColor = [UIColor purpleColor];
    self.phoneLabel.frame = CGRectMake(170, 10, self.contentView.frame.size.width - 180, 30);
    self.phoneLabel.backgroundColor = [UIColor blueColor];
    self.deleteButton.frame = CGRectMake(self.contentView.frame.size.width, 10, 50, 30);
    self.deleteButton.backgroundColor = [UIColor redColor];
    [self.deleteButton setTitle:@"删除" forState:UIControlStateNormal];
    [self.deleteButton addTarget:self action:@selector(deleteButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)deleteButtonAction:(UIButton *)deleteButton {
    [self.buttonDelete clickButtonName:self.nameLabel.text phone:self.phoneLabel.text];
    [self.clickButtonDeleteContact clickButtonDeleteContact:self];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
